package org.ch02.entity;

/**
 * 实体对象 - 基于反射实现一些测试操作
 * 修饰符 - Modifier
 * @author CSY
 * @date 2025 - 03 - 17
 */
public class Student {
    /**
     * 属性 - 字段 - Field
     */
    private String name;
    private int age;
    private float weight;
    private static double PI = 3.14;

    /**
     * 构造方法 - Construct
     */
    public Student() {
    }

    public Student(String name, int age, Double weight) {
        this.name = name;
        this.age = age;
        this.weight = weight.floatValue();
    }
    private Student(String name) {
        this.name = name;
        this.age = 18;
        this.weight = 100;
    }

    public Student(String name, Float weight) {
        this.name = name;
        this.age = 18;
        this.weight = weight;
    }

    /**
     * 方法 - Method
     * @return
     */
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public float getWeight() {
        return weight;
    }

    public void setWeight(float weight) {
        this.weight = weight;
    }

    public void hello() {
        System.out.println("你好!");
    }

    private String sleep(int hour,String address) {
        System.out.printf("睡觉了 - 地点：%s - 时长：%d", address, hour);
        return "天天睡，一直睡，睡觉真舒服";
    }

    public void sayHello(String who) {
        System.out.println("你好," + who);
    }

    public int sum(int i, int j) {
        return i + j;
    }

    @Override
    public String toString() {
        return this.getName()+","+this.getAge()+","+this.getWeight() ;
    }

    public static void study(){
        System.out.println("学习");
    }

    public void show(){
        System.out.printf("姓名：%s %n年龄：%d %n体重：%.2f %nPI：%.2f",this.getName(),this.getAge(),this.getWeight(),PI);
    }
}
